{block #mainTitle}Vzorkovna - položky{/block}
{block #head}{/block}
{block #content}
<h2>Položky kóje</h2>
<table class="data-table" n:if="count($showroom->related('showroom_has_tiles'))">
    <thead>
        <tr>
            <th>ID</th>
            <th>Kód</th>
            <th>Typ</th>
            <th>Rozměr</th>
            <th>Cena</th>
            <th>Akce</th>
        </tr>
    </thead>
    <tbody>        
        <tr n:foreach="$showroom->related('showroom_has_tiles') as $showroomHasTiles">
            {var $tile = $showroomHasTiles->tile}
            <td>{$tile->id_tile}</td>
            <td>{$tile->code}</td>
            <td>{$tile->type->title}</td>            
            <td>{$tile->width} cm x {$tile->height} cm</td>
            <td>{$tile->price|number:2:',':' '} Kč/{$tile->type->unit}</td>
            <td>
                <a class="action-icon-minus" href="{link odebratPolozku!, $showroom->id_showroom, $tile->id_tile}">odebrat</a>
            </td>
        </tr>        
    </tbody>
</table>
<h2>Položky pro přidání</h2>
<table class="data-table" n:if="count($tilesForAdd)">
    <thead>
        <tr>
            <th>ID</th>
            <th>Kód</th>
            <th>Typ</th>
            <th>Rozměr</th>
            <th>Cena</th>
            <th>Akce</th>
        </tr>
    </thead>
    <tbody>        
        <tr n:foreach="$tilesForAdd as $tileAdd">
            <td>{$tileAdd->id_tile}</td>
            <td>{$tileAdd->code}</td>
            <td>{$tileAdd->type->title}</td>            
            <td>{$tileAdd->width} cm x {$tileAdd->height} cm</td>
            <td>{$tileAdd->price|number:2:',':' '} Kč/{$tileAdd->type->unit}</td>
            <td>
                <a class="action-icon-plus" href="{link pridatPolozku!, $showroom->id_showroom, $tileAdd->id_tile}">přidat</a>
            </td>
        </tr>        
    </tbody>
</table>
<script type="text/javascript">
    initButtons();
    initAjaxLinks();
    
    $("a.ajax").on("click", function (event) {
                event.preventDefault();
                $.get(this.href);

                $("#ajax-spinner").show().css({
                    position: "absolute",
                    left: event.pageX + 15,
                    top: event.pageY + 15
                });
            });
</script>
{/block}

